package com.kotlin.baselib.rx

import com.kotlin.baselib.presenter.view.BaseView
import io.reactivex.rxjava3.core.Observer
import io.reactivex.rxjava3.disposables.Disposable


 abstract class BaseObserver<T> (val mBaseView:BaseView): Observer<T> {
    override fun onComplete() {
        mBaseView.hideLoading()

        //test


    }

    override fun onSubscribe(d: Disposable?) {
        mBaseView.showLoading()
    }

    override fun onNext(t: T) {
        onSuccess(t.toString())
    }

    override fun onError(e: Throwable?) {
        onError(e?.message.toString())
    }

    abstract fun onSuccess(data :String)

    abstract fun onError(message :String)
}